import {Component, Input, OnInit} from '@angular/core';
import {DiskPageStatus} from "@core/service/page/DiskPageStatus";
import {AuthService} from "@core/service/AuthService";
import {ClipboardService} from "@core/service/ClipboardService";
import {PageService} from "@core/service/page/PageService";
import {BBYUtils} from "@shared/utils/BBYUtils";
import {Router} from "@angular/router";

@Component({
  selector: 'bby-file-list',
  templateUrl: './file-list.component.html',
  styleUrls: ['./file-list.component.scss']
})
export class FileListComponent implements OnInit {
  @Input()
  pageService:PageService|undefined
  pageStatus:DiskPageStatus = new DiskPageStatus()
  constructor(
    public authService: AuthService,
    public clipboardService:ClipboardService,
    private router:Router
  ) {

  }

  ngOnInit(): void {

    if (this.pageService){
      this.pageStatus=this.pageService.pageStatus
    }
  }

  uploadClick() {
    // if (!currentFile||!currentFile.id){
    //   this.message.error('此处不能上传文件！')
    //   return;
    // }
  }

  getUserName(maker: any) {
    return BBYUtils.userIdNameMap.get(maker)||maker
  }

  openUser(userId: any) {
    let url = ''
    if (this.authService.userInfo?.userId==userId){
      url = '/myDisk/'+userId
    }else url = '/share/disk/'+userId
    this.router.navigate([url])
  }
}
